package com.minsf.springbootinit.judge.codesandbox.impl;

import java.util.List;

import com.minsf.springbootinit.judge.codesandbox.CodeSandbox;
import com.minsf.springbootinit.judge.codesandbox.model.ExecuteCodeRequest;
import com.minsf.springbootinit.judge.codesandbox.model.ExecuteCodeResponse;
import com.minsf.springbootinit.judge.codesandbox.model.JudgeInfo;
import com.minsf.springbootinit.model.enums.QuestionSubmitStatusEnum;

/**
 * @Description
 * @Author minify
 * @Date 2024/3/9 12:43
 * @Project oj-backend
 */
public class ExampleCodeSandbox implements CodeSandbox {
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        List<String> inputList = executeCodeRequest.getInputList();

        ExecuteCodeResponse executeCodeResponse = new ExecuteCodeResponse();
        executeCodeResponse.setOutputList(inputList);
        executeCodeResponse.setMessage("测试程序执行成功");
        executeCodeResponse.setStatus(QuestionSubmitStatusEnum.JUDGMENT_SUCCESS.getName());

        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage("判题");
        judgeInfo.setMemory(100);
        judgeInfo.setTime(100);
        executeCodeResponse.setJudgeInfo(judgeInfo);

        return executeCodeResponse;
    }
}
